
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: class p_con</title>
</head><body bgcolor="#f0f0f8">
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><strong>p_con.p_con</strong> = <a name="p_con.p_con">class p_con</a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Class&nbsp;to&nbsp;create&nbsp;Models&nbsp;to&nbsp;classify&nbsp;Molecules&nbsp;active&nbsp;or&nbsp;inactive<br>
using&nbsp;threshold&nbsp;for&nbsp;value&nbsp;in&nbsp;training-data<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="p_con-__init__"><strong>__init__</strong></a>(self, acc_id<font color="#909090">=None</font>, proxy<font color="#909090">={}</font>)</dt><dd><tt>Constructor&nbsp;to&nbsp;initialize&nbsp;Object,&nbsp;use&nbsp;proxy&nbsp;if&nbsp;neccessary</tt></dd></dl>

<dl><dt><a name="p_con-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>String-Representation&nbsp;for&nbsp;Object</tt></dd></dl>

<dl><dt><a name="p_con-load_models"><strong>load_models</strong></a>(self, model_files)</dt><dd><tt>load&nbsp;model&nbsp;or&nbsp;list&nbsp;of&nbsp;models&nbsp;into&nbsp;self.<strong>model</strong></tt></dd></dl>

<dl><dt><a name="p_con-load_mols"><strong>load_mols</strong></a>(self, sd_file)</dt><dd><tt>load&nbsp;SD-File&nbsp;from&nbsp;.sdf,&nbsp;.sdf.gz&nbsp;or&nbsp;.sd.gz</tt></dd></dl>

<dl><dt><a name="p_con-predict"><strong>predict</strong></a>(self, model_number)</dt><dd><tt>try&nbsp;to&nbsp;predict&nbsp;activity&nbsp;of&nbsp;compounds&nbsp;using&nbsp;giving&nbsp;model-Number</tt></dd></dl>

<dl><dt><a name="p_con-save_model"><strong>save_model</strong></a>(self, outfile, model_number<font color="#909090">=0</font>)</dt><dd><tt>save&nbsp;Model&nbsp;to&nbsp;file&nbsp;using&nbsp;cPickle.dump</tt></dd></dl>

<dl><dt><a name="p_con-save_model_info"><strong>save_model_info</strong></a>(self, outfile, mode<font color="#909090">='html'</font>)</dt><dd><tt>create&nbsp;html-&nbsp;or&nbsp;csv-File&nbsp;for&nbsp;models&nbsp;according&nbsp;to&nbsp;mode&nbsp;(default:&nbsp;"html")</tt></dd></dl>

<dl><dt><a name="p_con-save_mols"><strong>save_mols</strong></a>(self, outfile, gzip<font color="#909090">=True</font>)</dt><dd><tt>create&nbsp;SD-File&nbsp;of&nbsp;current&nbsp;molecules&nbsp;in&nbsp;self.<strong>sd_entries</strong></tt></dd></dl>

<dl><dt><a name="p_con-step_0_get_chembl_data"><strong>step_0_get_chembl_data</strong></a>(self)</dt><dd><tt>Download&nbsp;Compound-Data&nbsp;for&nbsp;self.<strong>acc_id</strong>,&nbsp;these&nbsp;are&nbsp;available&nbsp;in&nbsp;self.<strong>sd_entries</strong>&nbsp;afterwards</tt></dd></dl>

<dl><dt><a name="p_con-step_1_keeplargestfrag"><strong>step_1_keeplargestfrag</strong></a>(self)</dt><dd><tt>remove&nbsp;all&nbsp;smaller&nbsp;Fragments&nbsp;per&nbsp;compound,&nbsp;just&nbsp;keep&nbsp;the&nbsp;largest</tt></dd></dl>

<dl><dt><a name="p_con-step_2_remove_dupl"><strong>step_2_remove_dupl</strong></a>(self)</dt><dd><tt>remove&nbsp;duplicates&nbsp;from&nbsp;self.<strong>sd_entries</strong></tt></dd></dl>

<dl><dt><a name="p_con-step_3_merge_IC50"><strong>step_3_merge_IC50</strong></a>(self)</dt><dd><tt>merge&nbsp;IC50&nbsp;of&nbsp;duplicates&nbsp;into&nbsp;one&nbsp;compound&nbsp;using&nbsp;mean&nbsp;of&nbsp;all&nbsp;values&nbsp;if:<br>
min(IC50)&nbsp;=&gt;&nbsp;IC50_avg-3*IC50_stddev&nbsp;&amp;&amp;&nbsp;max(IC50)&nbsp;&lt;=&nbsp;IC50_avg+3*IC50_stddev&nbsp;&amp;&amp;&nbsp;IC50_stddev&nbsp;&lt;=&nbsp;IC50_avg</tt></dd></dl>

<dl><dt><a name="p_con-step_4_set_TL"><strong>step_4_set_TL</strong></a>(self, threshold, ic50_tag<font color="#909090">='value'</font>)</dt><dd><tt>set&nbsp;Property&nbsp;"TL"(TrafficLight)&nbsp;for&nbsp;each&nbsp;compound:<br>
if&nbsp;ic50_tag&nbsp;(default:"value")&nbsp;&gt;&nbsp;threshold:&nbsp;TL&nbsp;=&nbsp;0,&nbsp;else&nbsp;1</tt></dd></dl>

<dl><dt><a name="p_con-step_5_remove_descriptors"><strong>step_5_remove_descriptors</strong></a>(self)</dt><dd><tt>remove&nbsp;list&nbsp;of&nbsp;Properties&nbsp;from&nbsp;each&nbsp;compound&nbsp;(hardcoded)<br>
which&nbsp;would&nbsp;corrupt&nbsp;process&nbsp;of&nbsp;creating&nbsp;Prediction-Models</tt></dd></dl>

<dl><dt><a name="p_con-step_6_calc_descriptors"><strong>step_6_calc_descriptors</strong></a>(self)</dt><dd><tt>calculate&nbsp;descriptors&nbsp;for&nbsp;each&nbsp;compound,&nbsp;according&nbsp;to&nbsp;Descriptors._descList</tt></dd></dl>

<dl><dt><a name="p_con-step_7_train_models"><strong>step_7_train_models</strong></a>(self)</dt><dd><tt>train&nbsp;models&nbsp;according&nbsp;to&nbsp;trafficlight&nbsp;using&nbsp;sklearn.ensamble.RandomForestClassifier<br>
self.<strong>model</strong>&nbsp;contains&nbsp;up&nbsp;to&nbsp;10&nbsp;models&nbsp;afterwards,&nbsp;use&nbsp;<a href="#p_con.p_con-save_model_info">save_model_info</a>(type)&nbsp;to&nbsp;create&nbsp;csv&nbsp;or&nbsp;html<br>
containing&nbsp;data&nbsp;for&nbsp;each&nbsp;model</tt></dd></dl>

</td></tr></table>
</body></html>